package com.mz.ozy.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.GoodsListBean;
import com.mz.ozy.bean.VipRecordBean;
import com.mz.ozy.utils.Utils;

import java.util.List;

/**
 * @author lifeStyle on 2020/4/3 0003.
 */
public class VipRecordAdapter extends BaseQuickAdapter<VipRecordBean.PageBean.PageItemsBean, BaseViewHolder> {


    public VipRecordAdapter(List<VipRecordBean.PageBean.PageItemsBean> data) {
        super(R.layout.item_vip_record, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, VipRecordBean.PageBean.PageItemsBean item) {
        if (item.getGrade() == 1) {
            helper.setText(R.id.tv_vip_type, "欧卓雅VIP");

        } else if (item.getGrade() == 2) {
            helper.setText(R.id.tv_vip_type, "欧卓雅金卡VIP");

        } else if (item.getGrade() == 3) {
            helper.setText(R.id.tv_vip_type, "欧卓雅健康顾问");

        }
        helper.setText(R.id.tv_money, item.getAmt());
        if (item.getPay_state() == 0) {
            helper.setText(R.id.tv_status, "待支付");
            helper.setGone(R.id.ll_pay_button, true);


        } else if (item.getPay_state() == 1) {
            helper.setText(R.id.tv_status, "支付成功");
            helper.setGone(R.id.ll_pay_button, false);

        } else if (item.getPay_state() == 2) {
            helper.setText(R.id.tv_status, "支付取消");
            helper.setGone(R.id.ll_pay_button, false);

        }

        if (item.getPay_type() == 1) {
            helper.setText(R.id.tv_pay_type, "支付宝支付");

        } else {
            helper.setText(R.id.tv_pay_type, "微信支付");

        }

        if (TextUtils.isEmpty(item.getPayTime())) {
            helper.setGone(R.id.tv_pay_time, false);

        } else {
            helper.setGone(R.id.tv_pay_time, true);
            helper.setText(R.id.tv_pay_time, "支付时间：" + item.getPayTime());

        }
        helper.addOnClickListener(R.id.bnt_cancle);
        helper.addOnClickListener(R.id.bnt_pay);

    }
}
